<?php

class Vlib_Config_Writer_Array extends Zend_Config_Writer_Array {
    
    /**
     * Render a Zend_Config into a PHP Array config string.
     *
     * @since 1.10
     * @return string
     */
    public function render()
    {
        $data        = $this->_config->toArray();
        $sectionName = $this->_config->getSectionName();

        if (is_string($sectionName)) {
            $data = array($sectionName => $data);
        }
        
        $arrayString = "<?php\n"
                    ."\$config = " . var_export($data, true) . ";\n";

        $arrayString .= "\$env = APPLICATION_ENV;\nreturn \$config[\$env];";

        return $arrayString;
    }
    
}